package com.website.view
{
	
	import com.bakh.picWall.Bakh3DWall;
	import com.website.control.PathManager;
	import com.website.data.ProjectsXml;
	import com.website.event.FadeOutEvent;
	import com.website.event.SWFAddressEvent;
	import com.website.util.Constant;
	import com.website.util.DisplayUtil;
	import com.website.view.menu.MenuComponent;
	
	import flash.display.MovieClip;
	import flash.display.Sprite;
	import flash.display.Stage;
	import flash.display.StageDisplayState;
	import flash.display.StageScaleMode;
	import flash.events.Event;
	import flash.events.FullScreenEvent;
	import flash.events.MouseEvent;

	public class LayerManager
	{
		//根
		private static var _root:Sprite;
		private static var _stage:Stage;
		
		public static var uiLevel:MovieClip;
		private static var _welCome:WelcomePage
		private static var menuComponent:MenuComponent;
		private static var containerShell:ContainerShell;
		private static var _3dWall:WallContan;
		
		private static var pathNamesClone:Array;
		
		public static var picWallLevel:MovieClip;
		public static function get stage():Stage
		{
			return _stage;
		}

		public static function setup(con:Sprite):void
		{
			_root = con;
			_stage = con.stage;
//			_stage.scaleMode = StageScaleMode.NO_SCALE;
			uiLevel = new MovieClip();
			_stage.addChild(uiLevel);
			picWallLevel = new MovieClip();
			_stage.addChild(picWallLevel);
			Constant.doResize();
			_welCome = new WelcomePage();
			uiLevel.addChild(_welCome);
//			onWelcomePageClick(null);
			_welCome.addEventListener(FadeOutEvent.FADEOUT_COMPLETE, onWelcomePageClick);
			con.stage.addEventListener(Event.RESIZE, onResize);
		}
		
		private static function onResize(ev:Event):void
		{
//			Constant.resizeGrid();
			trace("resize");
//			menuComponent.x = Constant.gridX;
//			menuComponent.y = Math.round(Constant.gridY + Constant.gridCurrH);
		}
		
		private static function onWelcomePageClick(ev:FadeOutEvent):void
		{
			if(menuComponent == null)
			{
				menuComponent = new MenuComponent();
			}
			menuComponent.x = Constant.gridX;
			menuComponent.y = Math.round(Constant.gridY + Constant.gridCurrH);
			menuComponent.addEventListener("menuComponentClick", inMenuComponentClick);
			uiLevel.addChild(menuComponent);
			DisplayUtil.removeFromParent(_welCome);
			PathManager.addEventListener(SWFAddressEvent.CHANGE, handleSWFAddressChange, false, 0, true);
		}
		
		private static function inMenuComponentClick(ev:Event):void
		{
			if(_3dWall == null)
			{
				_3dWall = new WallContan();
				_3dWall.y = -80;
//				_3dWall.x = (Constant.gridCurrW - _3dWall.width)  /2;
			}
			stage.addChild(_3dWall);
		}
		
		private static function get pathNames():Array
		{
			return PathManager.pathNames;
		}

		private static function handleSWFAddressChange(event:SWFAddressEvent):void
		{
			PathManager.pathNames = event.pathNames;
			try{
				pushSWFAddressChange();
				
			}catch(e:Error)
			{
				trace("asdfsdfa");	
			}
			return;
		}
		
		private static function onStageClick(ev:MouseEvent):void
		{
			fullScreen();
		}
		
		private static function fullScreen():void
		{
			stage.displayState = StageDisplayState.FULL_SCREEN;
		}
		
		private function get pathNames():Array
		{
			return PathManager.pathNames;
		}
		
		private static function comparePathNames(param1:int) : Boolean
		{
			var _loc_2:int = 0;
			_loc_2 = 0;
			while (_loc_2 < param1)
			{
				
				if (pathNames[_loc_2] != pathNamesClone[_loc_2])
				{
					return false;
				}
				_loc_2++;
			}
			return true;
		}
		
		private static function clonePathNames()
		{
			var _loc_1:int = 0;
			pathNamesClone = [];
			_loc_1 = 0;
			while (_loc_1 < pathNames.length)
			{
				
				pathNamesClone.push(pathNames[_loc_1]);
				_loc_1++;
			}
			return;
		}
		
		private static  function pushSWFAddressChange() : void
		{
			 
			if (PathManager.pathNames[0] == "projects")
			{
				menuComponent.autoSwitch(0);
			}
			else if (PathManager.pathNames[0] == "practice")
			{
				menuComponent.autoSwitch(1);
			}
			else if (PathManager.pathNames[0] == "contact")
			{
				menuComponent.autoSwitch(2);
			}
			else if (PathManager.pathNames[0] == "news")
			{
//				tracer.text = "autoSwitch news";
				menuComponent.autoSwitch(3);
			}
			else if (PathManager.pathNames[0] == "bookmarks")
			{
				menuComponent.autoSwitch(4);
			}
			else if (PathManager.pathNames[0] == "search")
			{
				menuComponent.autoSwitch(5);
			}
			
			switch(pathNames[0])
			{
				case "projects":
				{
//					turnOffHomeShell();
					switch(PathManager.pathNames[1])
					{
						case "architecture":
						{
							menuComponent.naveComp.hRule1On();
							switch(pathNames[2])
							{
								case "visual":
								{
									if (pathNames[4] != undefined)
									{
										menuComponent.naveComp.hRule1On();
										if (pathNames[5] == "sub")
										{
											if (comparePathNames(5) == true)
											{
												if (pathNames[7] != undefined)
												{
													containerShell.updateProjectSubNav(pathNames[6], pathNames[7]);
												}
												else if (pathNames[6] != undefined)
												{
													clonePathNames();
													containerShell.updateProjectSubNav(pathNames[6], 0);
												}
												else
												{
													clonePathNames();
													containerShell.updateProjectSubNav(0, 0);
												}
											}
											else
											{
												clonePathNames();
												if (pathNames[7] != undefined)
												{
													containerShell.newSubProject(pathNames[4], 5, pathNames[6], pathNames[7]);
												}
												else if (pathNames[6] != undefined)
												{
													containerShell.newSubProject(pathNames[4], 5, pathNames[6], 0);
												}
												else
												{
													containerShell.newSubProject(pathNames[4], 5, 0, 0);
												}
											}
										}
										else if (pathNames[5] != undefined)
										{
											if (comparePathNames(5) == true)
											{
												containerShell.updateProjectNav(pathNames[5]);
											}
											else
											{
												clonePathNames();
												containerShell.newProject(pathNames[4], pathNames[5]);
											}
										}
										else
										{
											containerShell.newProject(pathNames[4], 0);
										}
									}
									else if (pathNames[3] != undefined)
									{
										pathNamesClone = [];
										var _loc_3:int = 0;
										var _loc_6:int = 0;
										var _loc_7:* = ProjectsXml.projectsxml.projects.tier0;//myXML.nav.projects.tier0;
										var _loc_5:* = new XMLList("");
										for each (_loc_8 in _loc_7)
										{
											
											var _loc_9:* = _loc_7[_loc_6];
											with (_loc_7[_loc_6])
											{
												if (@label == "Architecture")
												{
													_loc_5[_loc_6] = _loc_8;
												}
											}
										}
										var _loc_4:* = _loc_5.tier1;
										var _loc_2:* = new XMLList("");
										for each (_loc_5 in _loc_4)
										{
											
											var _loc_6:* = _loc_4[_loc_3];
											with (_loc_4[_loc_3])
											{
												if (@label == "Visual")
												{
													_loc_2[_loc_3] = _loc_5;
												}
											}
										}
										containerShell.newShell("visualShell", _loc_2, pathNames[3]);
									}
									break;
								}
								case "icons":
								{
									if (pathNames[4] != undefined)
									{
										menuComponent.naveComp.hRule1On();
										if (pathNames[5] == "sub")
										{
											if (comparePathNames(5) == true)
											{
												if (pathNames[7] != undefined)
												{
													containerShell.updateProjectSubNav(pathNames[6], pathNames[7]);
												}
												else if (pathNames[6] != undefined)
												{
													clonePathNames();
													containerShell.updateProjectSubNav(pathNames[6], 0);
												}
												else
												{
													clonePathNames();
													containerShell.updateProjectSubNav(0, 0);
												}
											}
											else
											{
												clonePathNames();
												if (pathNames[7] != undefined)
												{
													containerShell.newSubProject(pathNames[4], 5, pathNames[6], pathNames[7]);
												}
												else if (pathNames[6] != undefined)
												{
													containerShell.newSubProject(pathNames[4], 5, pathNames[6], 0);
												}
												else
												{
													containerShell.newSubProject(pathNames[4], 5, 0, 0);
												}
											}
										}
										else if (pathNames[5] != undefined)
										{
											if (comparePathNames(5) == true)
											{
												containerShell.updateProjectNav(pathNames[5]);
											}
											else
											{
												clonePathNames();
												containerShell.newProject(pathNames[4], pathNames[5]);
											}
										}
										else
										{
											containerShell.newProject(pathNames[4], 0);
										}
									}
									else if (pathNames[3] != undefined)
									{
										pathNamesClone = [];
										var _loc_3:int = 0;
										var _loc_6:int = 0;
										var _loc_7:* = ProjectsXml.projectsxml.projects.tier0//myXML.nav.projects.tier0;
										var _loc_5:* = new XMLList("");
										for each (_loc_8 in _loc_7)
										{
											
											var _loc_9:* = _loc_7[_loc_6];
											with (_loc_7[_loc_6])
											{
												if (@label == "Architecture")
												{
													_loc_5[_loc_6] = _loc_8;
												}
											}
										}
										var _loc_4:* = _loc_5.tier1;
										var _loc_2:* = new XMLList("");
										for each (_loc_5 in _loc_4)
										{
											
											var _loc_6:* = _loc_4[_loc_3];
											with (_loc_4[_loc_3])
											{
												if (@label == "Icons")
												{
													_loc_2[_loc_3] = _loc_5;
												}
											}
										}
										containerShell.newShell("projectIconShell", _loc_2, pathNames[3]);
									}
									break;
								}
								case "name":
								{
									if (pathNames[4] != undefined)
									{
										menuComponent.naveComp.hRule1On();
										if (pathNames[5] == "sub")
										{
											if (comparePathNames(5) == true)
											{
												if (pathNames[7] != undefined)
												{
													containerShell.updateProjectSubNav(pathNames[6], pathNames[7]);
												}
												else if (pathNames[6] != undefined)
												{
													clonePathNames();
													containerShell.updateProjectSubNav(pathNames[6], 0);
												}
												else
												{
													clonePathNames();
													containerShell.updateProjectSubNav(0, 0);
												}
											}
											else
											{
												clonePathNames();
												if (pathNames[7] != undefined)
												{
													containerShell.newSubProject(pathNames[4], 5, pathNames[6], pathNames[7]);
												}
												else if (pathNames[6] != undefined)
												{
													containerShell.newSubProject(pathNames[4], 5, pathNames[6], 0);
												}
												else
												{
													containerShell.newSubProject(pathNames[4], 5, 0, 0);
												}
											}
										}
										else if (pathNames[5] != undefined)
										{
											if (comparePathNames(5) == true)
											{
												containerShell.updateProjectNav(pathNames[5]);
											}
											else
											{
												clonePathNames();
												containerShell.newProject(pathNames[4], pathNames[5]);
											}
										}
										else
										{
											containerShell.newProject(pathNames[4], 0);
										}
									}
									else if (pathNames[3] != undefined)
									{
										pathNamesClone = [];
										var _loc_3:int = 0;
										var _loc_6:int = 0;
										var _loc_7:* = ProjectsXml.projectsxml.projects.tier0;//myXML.nav.projects.tier0;
										var _loc_5:* = new XMLList("");
										for each (_loc_8 in _loc_7)
										{
											
											var _loc_9:* = _loc_7[_loc_6];
											with (_loc_7[_loc_6])
											{
												if (@label == "Architecture")
												{
													_loc_5[_loc_6] = _loc_8;
												}
											}
										}
										var _loc_4:* = _loc_5.tier1;
										var _loc_2:* = new XMLList("");
										for each (_loc_5 in _loc_4)
										{
											
											var _loc_6:* = _loc_4[_loc_3];
											with (_loc_4[_loc_3])
											{
												if (@label == "Name")
												{
													_loc_2[_loc_3] = _loc_5;
												}
											}
										}
										containerShell.newShell("nameShell", _loc_2.tier2, pathNames[3]);
									}
									break;
								}
								case "type":
								{
									if (pathNames[3] != undefined)
									{
										if (pathNames[5] != undefined)
										{
											if (pathNames[6] == "sub")
											{
												if (comparePathNames(6) == true)
												{
													if (pathNames[8] != undefined)
													{
														containerShell.updateProjectSubNav(pathNames[7], pathNames[8]);
													}
													else if (pathNames[7] != undefined)
													{
														clonePathNames();
														containerShell.updateProjectSubNav(pathNames[7], 0);
													}
													else
													{
														clonePathNames();
														containerShell.updateProjectSubNav(0, 0);
													}
												}
												else
												{
													clonePathNames();
													if (pathNames[7] != undefined)
													{
														containerShell.newSubProject(pathNames[5], 6, pathNames[7], pathNames[8]);
													}
													else if (pathNames[6] != undefined)
													{
														containerShell.newSubProject(pathNames[5], 6, pathNames[7], 0);
													}
													else
													{
														containerShell.newSubProject(pathNames[5], 6, 0, 0);
													}
												}
											}
											else if (pathNames[6] != undefined)
											{
												if (comparePathNames(6) == true)
												{
													containerShell.updateProjectNav(pathNames[6]);
												}
												else
												{
													clonePathNames();
													containerShell.newProject(pathNames[5], pathNames[6]);
												}
											}
											else
											{
												containerShell.newProject(pathNames[5], 0);
											}
										}
										else
										{
											pathNamesClone = [];
											if (pathNames[3] == "icons")
											{
												var _loc_3:int = 0;
												var _loc_6:int = 0;
												var _loc_9:int = 0;
												var _loc_10:* = ProjectsXml.projectsxml.projects.tier0;//myXML.nav.projects.tier0;
												var _loc_8:* = new XMLList("");
												for each (_loc_11 in _loc_10)
												{
													
													var _loc_12:* = _loc_10[_loc_9];
													with (_loc_10[_loc_9])
													{
														if (@label == "Architecture")
														{
															_loc_8[_loc_9] = _loc_11;
														}
													}
												}
												var _loc_7:* = _loc_8.tier1;
												var _loc_5:* = new XMLList("");
												for each (_loc_8 in _loc_7)
												{
													
													var _loc_9:* = _loc_7[_loc_6];
													with (_loc_7[_loc_6])
													{
														if (@label == "Type")
														{
															_loc_5[_loc_6] = _loc_8;
														}
													}
												}
												var _loc_4:* = _loc_5.tier2;
												var _loc_2:* = new XMLList("");
												for each (_loc_5 in _loc_4)
												{
													
													var _loc_6:* = _loc_4[_loc_3];
													with (_loc_4[_loc_3])
													{
														if (@label == "Icons")
														{
															_loc_2[_loc_3] = _loc_5;
														}
													}
												}
												containerShell.newShell("iconShell", _loc_2, pathNames[4]);
											}
											else
											{
												var _loc_3:int = 0;
												var _loc_6:int = 0;
												var _loc_9:int = 0;
												var _loc_10:* = ProjectsXml.projectsxml.projects.tier0;//myXML.nav.projects.tier0;
												var _loc_8:* = new XMLList("");
												for each (_loc_11 in _loc_10)
												{
													
													var _loc_12:* = _loc_10[_loc_9];
													with (_loc_10[_loc_9])
													{
														if (@label == "Architecture")
														{
															_loc_8[_loc_9] = _loc_11;
														}
													}
												}
												var _loc_7:* = _loc_8.tier1;
												var _loc_5:* = new XMLList("");
												for each (_loc_8 in _loc_7)
												{
													
													var _loc_9:* = _loc_7[_loc_6];
													with (_loc_7[_loc_6])
													{
														if (@label == "Type")
														{
															_loc_5[_loc_6] = _loc_8;
														}
													}
												}
												var _loc_4:* = _loc_5.tier2;
												var _loc_2:* = new XMLList("");
												for each (_loc_5 in _loc_4)
												{
													
													var _loc_6:* = _loc_4[_loc_3];
													with (_loc_4[_loc_3])
													{
														if (@label == toUppercase(pathNames[3]))
														{
															_loc_2[_loc_3] = _loc_5;
														}
													}
												}
												containerShell.newShell("typeShell", _loc_2, pathNames[4]);
											}
										}
									}
									break;
								}
								case "date":
								{
									if (pathNames[5] != undefined)
									{
										if (pathNames[6] == "sub")
										{
											if (comparePathNames(6) == true)
											{
												if (pathNames[8] != undefined)
												{
													containerShell.updateProjectSubNav(pathNames[7], pathNames[8]);
												}
												else if (pathNames[7] != undefined)
												{
													clonePathNames();
													containerShell.updateProjectSubNav(pathNames[7], 0);
												}
												else
												{
													clonePathNames();
													containerShell.updateProjectSubNav(0, 0);
												}
											}
											else
											{
												clonePathNames();
												if (pathNames[8] != undefined)
												{
													containerShell.newSubProject(pathNames[5], 6, pathNames[7], pathNames[8]);
												}
												else if (pathNames[7] != undefined)
												{
													containerShell.newSubProject(pathNames[5], 6, pathNames[7], 0);
												}
												else
												{
													containerShell.newSubProject(pathNames[5], 6, 0, 0);
												}
											}
										}
										else if (pathNames[6] != undefined)
										{
											if (comparePathNames(6) == true)
											{
												containerShell.updateProjectNav(pathNames[6]);
											}
											else
											{
												clonePathNames();
												containerShell.newProject(pathNames[5], pathNames[6]);
											}
										}
										else
										{
											containerShell.newProject(pathNames[5], 0);
										}
									}
									else
									{
										pathNamesClone = [];
										if (pathNames[3] != undefined)
										{
											switch(pathNames[3])
											{
												case "start-date":
												{
													var _loc_3:int = 0;
													var _loc_6:int = 0;
													var _loc_9:int = 0;
													var _loc_10:* =ProjectsXml.projectsxml.projects.tier0;// myXML.nav.projects.tier0;
													var _loc_8:* = new XMLList("");
													for each (_loc_11 in _loc_10)
													{
														
														var _loc_12:* = _loc_10[_loc_9];
														with (_loc_10[_loc_9])
														{
															if (@label == "Architecture")
															{
																_loc_8[_loc_9] = _loc_11;
															}
														}
													}
													var _loc_7:* = _loc_8.tier1;
													var _loc_5:* = new XMLList("");
													for each (_loc_8 in _loc_7)
													{
														
														var _loc_9:* = _loc_7[_loc_6];
														with (_loc_7[_loc_6])
														{
															if (@label == "Date")
															{
																_loc_5[_loc_6] = _loc_8;
															}
														}
													}
													var _loc_4:* = _loc_5.tier2;
													var _loc_2:* = new XMLList("");
													for each (_loc_5 in _loc_4)
													{
														
														var _loc_6:* = _loc_4[_loc_3];
														with (_loc_4[_loc_3])
														{
															if (@label == "Start Date")
															{
																_loc_2[_loc_3] = _loc_5;
															}
														}
													}
													containerShell.newShell("dateShell", _loc_2.tier3, pathNames[4]);
													break;
												}
												case "end-date":
												{
													var _loc_3:int = 0;
													var _loc_6:int = 0;
													var _loc_9:int = 0;
													var _loc_10:* = ProjectsXml.projectsxml.projects.tier0;//myXML.nav.projects.tier0;
													var _loc_8:* = new XMLList("");
													for each (_loc_11 in _loc_10)
													{
														
														var _loc_12:* = _loc_10[_loc_9];
														with (_loc_10[_loc_9])
														{
															if (@label == "Architecture")
															{
																_loc_8[_loc_9] = _loc_11;
															}
														}
													}
													var _loc_7:* = _loc_8.tier1;
													var _loc_5:* = new XMLList("");
													for each (_loc_8 in _loc_7)
													{
														
														var _loc_9:* = _loc_7[_loc_6];
														with (_loc_7[_loc_6])
														{
															if (@label == "Date")
															{
																_loc_5[_loc_6] = _loc_8;
															}
														}
													}
													var _loc_4:* = _loc_5.tier2;
													var _loc_2:* = new XMLList("");
													for each (_loc_5 in _loc_4)
													{
														
														var _loc_6:* = _loc_4[_loc_3];
														with (_loc_4[_loc_3])
														{
															if (@label == "End Date")
															{
																_loc_2[_loc_3] = _loc_5;
															}
														}
													}
													containerShell.newShell("dateShell", _loc_2.tier3, pathNames[4]);
													break;
												}
												case "current":
												{
													var _loc_3:int = 0;
													var _loc_6:int = 0;
													var _loc_9:int = 0;
													var _loc_10:* = ProjectsXml.projectsxml.projects.tier0;//myXML.nav.projects.tier0;
													var _loc_8:* = new XMLList("");
													for each (_loc_11 in _loc_10)
													{
														
														var _loc_12:* = _loc_10[_loc_9];
														with (_loc_10[_loc_9])
														{
															if (@label == "Architecture")
															{
																_loc_8[_loc_9] = _loc_11;
															}
														}
													}
													var _loc_7:* = _loc_8.tier1;
													var _loc_5:* = new XMLList("");
													for each (_loc_8 in _loc_7)
													{
														
														var _loc_9:* = _loc_7[_loc_6];
														with (_loc_7[_loc_6])
														{
															if (@label == "Date")
															{
																_loc_5[_loc_6] = _loc_8;
															}
														}
													}
													var _loc_4:* = _loc_5.tier2;
													var _loc_2:* = new XMLList("");
													for each (_loc_5 in _loc_4)
													{
														
														var _loc_6:* = _loc_4[_loc_3];
														with (_loc_4[_loc_3])
														{
															if (@label == "Current")
															{
																_loc_2[_loc_3] = _loc_5;
															}
														}
													}
													containerShell.newShell("typeShell", _loc_2, pathNames[4]);
													break;
												}
												case "unbuilt":
												{
													var _loc_3:int = 0;
													var _loc_6:int = 0;
													var _loc_9:int = 0;
													var _loc_10:* = ProjectsXml.projectsxml.projects.tier0;//myXML.nav.projects.tier0;
													var _loc_8:* = new XMLList("");
													for each (_loc_11 in _loc_10)
													{
														
														var _loc_12:* = _loc_10[_loc_9];
														with (_loc_10[_loc_9])
														{
															if (@label == "Architecture")
															{
																_loc_8[_loc_9] = _loc_11;
															}
														}
													}
													var _loc_7:* = _loc_8.tier1;
													var _loc_5:* = new XMLList("");
													for each (_loc_8 in _loc_7)
													{
														
														var _loc_9:* = _loc_7[_loc_6];
														with (_loc_7[_loc_6])
														{
															if (@label == "Date")
															{
																_loc_5[_loc_6] = _loc_8;
															}
														}
													}
													var _loc_4:* = _loc_5.tier2;
													var _loc_2:* = new XMLList("");
													for each (_loc_5 in _loc_4)
													{
														
														var _loc_6:* = _loc_4[_loc_3];
														with (_loc_4[_loc_3])
														{
															if (@label == "Unbuilt")
															{
																_loc_2[_loc_3] = _loc_5;
															}
														}
													}
													containerShell.newShell("typeShell", _loc_2, pathNames[4]);
													break;
												}
												default:
												{
													break;
												}
											}
										}
									}
									break;
								}
								case "location":
								{
									if (pathNames[6] != undefined)
									{
										if (pathNames[7] == "sub")
										{
											if (comparePathNames(7) == true)
											{
												if (pathNames[9] != undefined)
												{
													containerShell.updateProjectSubNav(pathNames[8], pathNames[9]);
												}
												else if (pathNames[8] != undefined)
												{
													clonePathNames();
													containerShell.updateProjectSubNav(pathNames[8], 0);
												}
												else
												{
													clonePathNames();
													containerShell.updateProjectSubNav(0, 0);
												}
											}
											else
											{
												clonePathNames();
												if (pathNames[9] != undefined)
												{
													containerShell.newSubProject(pathNames[6], 7, pathNames[8], pathNames[8]);
												}
												else if (pathNames[6] != undefined)
												{
													containerShell.newSubProject(pathNames[6], 7, pathNames[8], 0);
												}
												else
												{
													containerShell.newSubProject(pathNames[6], 7, 0, 0);
												}
											}
										}
										else if (pathNames[7] != undefined)
										{
											if (comparePathNames(7) == true)
											{
												containerShell.updateProjectNav(pathNames[7]);
											}
											else
											{
												clonePathNames();
												containerShell.newProject(pathNames[6], pathNames[7]);
											}
										}
										else
										{
											clonePathNames();
											containerShell.newProject(pathNames[6], 0);
										}
									}
									else if (pathNames[3] != undefined)
									{
										pathNamesClone = [];
										var _loc_3:int = 0;
										var _loc_6:int = 0;
										var _loc_9:int = 0;
										var _loc_12:int = 0;
										var _loc_13:* = ProjectsXml.projectsxml.projects.tier0;//myXML.nav.projects.tier0;
										var _loc_11:* = new XMLList("");
										for each (var xml:XML in _loc_13)
										{
											
											var _loc_15:* = _loc_13[_loc_12];
											with (_loc_13[_loc_12])
											{
												if (@label == "Architecture")
												{
													_loc_11[_loc_12] = xml;
												}
											}
										}
										var _loc_10:* = _loc_11.tier1;
										var _loc_8:* = new XMLList("");
										for each (_loc_11 in _loc_10)
										{
											
											var _loc_12:* = _loc_10[_loc_9];
											with (_loc_10[_loc_9])
											{
												if (@label == "Location")
												{
													_loc_8[_loc_9] = _loc_11;
												}
											}
										}
										var _loc_7:* = _loc_8.tier2;
										var _loc_5:* = new XMLList("");
										for each (_loc_8 in _loc_7)
										{
											
											var _loc_9:* = _loc_7[_loc_6];
											with (_loc_7[_loc_6])
											{
												if (@label == toUppercaseWithCaps(pathNames[3]))
												{
													_loc_5[_loc_6] = _loc_8;
												}
											}
										}
										var _loc_4:* = _loc_5.tier3;
										var _loc_2:* = new XMLList("");
										for each (_loc_5 in _loc_4)
										{
											
											var _loc_6:* = _loc_4[_loc_3];
											with (_loc_4[_loc_3])
											{
												if (@label == toUppercase(pathNames[4]))
												{
													_loc_2[_loc_3] = _loc_5;
												}
											}
										}
										containerShell.newShell("locationShell", _loc_2.tier4, pathNames[5]);
									}
									break;
								}
								default:
								{
									break;
								}
							}
							break;
						}
						case "products":
						{
							switch(pathNames[2])
							{
								case "name":
								{
									if (pathNames[4] != undefined)
									{
										menuComponent.naveComp.hRule1On();
										if (pathNames[5] == "sub")
										{
											if (comparePathNames(5) == true)
											{
												if (pathNames[7] != undefined)
												{
													containerShell.updateProjectSubNav(pathNames[6], pathNames[7]);
												}
												else if (pathNames[6] != undefined)
												{
													clonePathNames();
													containerShell.updateProjectSubNav(pathNames[6], 0);
												}
												else
												{
													clonePathNames();
													containerShell.updateProjectSubNav(0, 0);
												}
											}
											else
											{
												clonePathNames();
												if (pathNames[7] != undefined)
												{
													containerShell.newSubProject(pathNames[4], 5, pathNames[6], pathNames[7]);
												}
												else if (pathNames[6] != undefined)
												{
													containerShell.newSubProject(pathNames[4], 5, pathNames[6], 0);
												}
												else
												{
													containerShell.newSubProject(pathNames[4], 5, 0, 0);
												}
											}
										}
										else if (pathNames[5] != undefined)
										{
											if (comparePathNames(5) == true)
											{
												containerShell.updateProjectNav(pathNames[5]);
											}
											else
											{
												clonePathNames();
												containerShell.newProject(pathNames[4], pathNames[5]);
											}
										}
										else
										{
											containerShell.newProject(pathNames[4], 0);
										}
									}
									else if (pathNames[3] != undefined)
									{
										pathNamesClone = [];
										var _loc_3:int = 0;
										var _loc_6:int = 0;
										var _loc_7:* = ProjectsXml.projectsxml.projects.tier0;//myXML.nav.projects.tier0;
										var _loc_5:* = new XMLList("");
										for each (_loc_8 in _loc_7)
										{
											
											var _loc_9:* = _loc_7[_loc_6];
											with (_loc_7[_loc_6])
											{
												if (@label == "Products")
												{
													_loc_5[_loc_6] = _loc_8;
												}
											}
										}
										var _loc_4:* = _loc_5.tier1;
										var _loc_2:* = new XMLList("");
										for each (_loc_5 in _loc_4)
										{
											
											var _loc_6:* = _loc_4[_loc_3];
											with (_loc_4[_loc_3])
											{
												if (@label == "Name")
												{
													_loc_2[_loc_3] = _loc_5;
												}
											}
										}
										containerShell.newShell("nameShell", _loc_2.tier2, pathNames[3]);
									}
									break;
								}
								case "type":
								{
									if (pathNames[3] != undefined)
									{
										if (pathNames[5] != undefined)
										{
											if (pathNames[6] == "sub")
											{
												if (comparePathNames(6) == true)
												{
													if (pathNames[8] != undefined)
													{
														containerShell.updateProjectSubNav(pathNames[7], pathNames[8]);
													}
													else if (pathNames[7] != undefined)
													{
														clonePathNames();
														containerShell.updateProjectSubNav(pathNames[7], 0);
													}
													else
													{
														clonePathNames();
														containerShell.updateProjectSubNav(0, 0);
													}
												}
												else
												{
													clonePathNames();
													if (pathNames[8] != undefined)
													{
														containerShell.newSubProject(pathNames[5], 6, pathNames[7], pathNames[8]);
													}
													else if (pathNames[7] != undefined)
													{
														containerShell.newSubProject(pathNames[5], 6, pathNames[7], 0);
													}
													else
													{
														containerShell.newSubProject(pathNames[5], 6, 0, 0);
													}
												}
											}
											else if (pathNames[6] != undefined)
											{
												if (comparePathNames(6) == true)
												{
													containerShell.updateProjectNav(pathNames[6]);
												}
												else
												{
													clonePathNames();
													containerShell.newProject(pathNames[5], pathNames[6]);
												}
											}
											else
											{
												containerShell.newProject(pathNames[5], 0);
											}
										}
										else
										{
											pathNamesClone = [];
											var _loc_3:int = 0;
											var _loc_6:int = 0;
											var _loc_9:int = 0;
											var _loc_10:* = ProjectsXml.projectsxml.projects.tier0;//myXML.nav.projects.tier0;
											var _loc_8:* = new XMLList("");
											for each (_loc_11 in _loc_10)
											{
												
												var _loc_12:* = _loc_10[_loc_9];
												with (_loc_10[_loc_9])
												{
													if (@label == "Products")
													{
														_loc_8[_loc_9] = _loc_11;
													}
												}
											}
											var _loc_7:* = _loc_8.tier1;
											var _loc_5:* = new XMLList("");
											for each (_loc_8 in _loc_7)
											{
												
												var _loc_9:* = _loc_7[_loc_6];
												with (_loc_7[_loc_6])
												{
													if (@label == "Type")
													{
														_loc_5[_loc_6] = _loc_8;
													}
												}
											}
											var _loc_4:* = _loc_5.tier2;
											var _loc_2:* = new XMLList("");
											for each (_loc_5 in _loc_4)
											{
												
												var _loc_6:* = _loc_4[_loc_3];
												with (_loc_4[_loc_3])
												{
													if (@label == toUppercase(pathNames[3]))
													{
														_loc_2[_loc_3] = _loc_5;
													}
												}
											}
//											containerShell.newShell("typeShell", _loc_2, pathNames[4]);
										}
									}
									break;
								}
								case "date":
								{
									if (pathNames[4] != undefined)
									{
										if (pathNames[5] == "sub")
										{
											if (comparePathNames(5) == true)
											{
												if (pathNames[7] != undefined)
												{
													containerShell.updateProjectSubNav(pathNames[6], pathNames[7]);
												}
												else if (pathNames[6] != undefined)
												{
													clonePathNames();
													containerShell.updateProjectSubNav(pathNames[6], 0);
												}
												else
												{
													clonePathNames();
													containerShell.updateProjectSubNav(0, 0);
												}
											}
											else
											{
												clonePathNames();
												if (pathNames[7] != undefined)
												{
													containerShell.newSubProject(pathNames[4], 5, pathNames[6], pathNames[7]);
												}
												else if (pathNames[6] != undefined)
												{
													containerShell.newSubProject(pathNames[4], 5, pathNames[6], 0);
												}
												else
												{
													containerShell.newSubProject(pathNames[4], 5, 0, 0);
												}
											}
										}
										else if (pathNames[5] != undefined)
										{
											if (comparePathNames(5) == true)
											{
												containerShell.updateProjectNav(pathNames[5]);
											}
											else
											{
												clonePathNames();
												containerShell.newProject(pathNames[4], pathNames[5]);
											}
										}
										else
										{
											containerShell.newProject(pathNames[4], 0);
										}
									}
									else
									{
										pathNamesClone = [];
										if (pathNames[3] != undefined)
										{
											var _loc_3:int = 0;
											var _loc_6:int = 0;
											var _loc_7:* = ProjectsXml.projectsxml.projects.tier0;//myXML.nav.projects.tier0;
											var _loc_5:* = new XMLList("");
											for each (_loc_8 in _loc_7)
											{
												
												var _loc_9:* = _loc_7[_loc_6];
												with (_loc_7[_loc_6])
												{
													if (@label == "Products")
													{
														_loc_5[_loc_6] = _loc_8;
													}
												}
											}
											var _loc_4:* = _loc_5.tier1;
											var _loc_2:* = new XMLList("");
											for each (_loc_5 in _loc_4)
											{
												
												var _loc_6:* = _loc_4[_loc_3];
												with (_loc_4[_loc_3])
												{
													if (@label == "Date")
													{
														_loc_2[_loc_3] = _loc_5;
													}
												}
											}
											containerShell.newShell("dateShell", _loc_2.tier2, pathNames[4]);
										}
									}
									break;
								}
								case "visual":
								{
									if (pathNames[4] != undefined)
									{
										menuComponent.naveComp.hRule1On();
										if (pathNames[5] == "sub")
										{
											if (comparePathNames(5) == true)
											{
												if (pathNames[7] != undefined)
												{
													containerShell.updateProjectSubNav(pathNames[6], pathNames[7]);
												}
												else if (pathNames[6] != undefined)
												{
													clonePathNames();
													containerShell.updateProjectSubNav(pathNames[6], 0);
												}
												else
												{
													clonePathNames();
													containerShell.updateProjectSubNav(0, 0);
												}
											}
											else
											{
												clonePathNames();
												if (pathNames[7] != undefined)
												{
													containerShell.newSubProject(pathNames[4], 5, pathNames[6], pathNames[7]);
												}
												else if (pathNames[6] != undefined)
												{
													containerShell.newSubProject(pathNames[4], 5, pathNames[6], 0);
												}
												else
												{
													containerShell.newSubProject(pathNames[4], 5, 0, 0);
												}
											}
										}
										else if (pathNames[5] != undefined)
										{
											if (comparePathNames(5) == true)
											{
												containerShell.updateProjectNav(pathNames[5]);
											}
											else
											{
												clonePathNames();
												containerShell.newProject(pathNames[4], pathNames[5]);
											}
										}
										else
										{
											containerShell.newProject(pathNames[4], 0);
										}
									}
									else if (pathNames[3] != undefined)
									{
										pathNamesClone = [];
										var _loc_3:int = 0;
										var _loc_6:int = 0;
										var _loc_7:* = ProjectsXml.projectsxml.projects.tier0;//myXML.nav.projects.tier0;
										var _loc_5:* = new XMLList("");
										for each (_loc_8 in _loc_7)
										{
											
											var _loc_9:* = _loc_7[_loc_6];
											with (_loc_7[_loc_6])
											{
												if (@label == "Products")
												{
													_loc_5[_loc_6] = _loc_8;
												}
											}
										}
										var _loc_4:* = _loc_5.tier1;
										var _loc_2:* = new XMLList("");
										for each (_loc_5 in _loc_4)
										{
											
											var _loc_6:* = _loc_4[_loc_3];
											with (_loc_4[_loc_3])
											{
												if (@label == "Visual")
												{
													_loc_2[_loc_3] = _loc_5;
												}
											}
										}
										containerShell.newShell("visualShell", _loc_2, pathNames[3]);
									}
									break;
								}
								default:
								{
									break;
								}
							}
							break;
						}
						case "exhibitions":
						{
							switch(pathNames[2])
							{
								case "name":
								{
									if (pathNames[4] != undefined)
									{
										menuComponent.naveComp.hRule1On();
										if (pathNames[5] == "sub")
										{
											if (comparePathNames(5) == true)
											{
												if (pathNames[7] != undefined)
												{
													containerShell.updateProjectSubNav(pathNames[6], pathNames[7]);
												}
												else if (pathNames[6] != undefined)
												{
													clonePathNames();
													containerShell.updateProjectSubNav(pathNames[6], 0);
												}
												else
												{
													clonePathNames();
													containerShell.updateProjectSubNav(0, 0);
												}
											}
											else
											{
												clonePathNames();
												if (pathNames[7] != undefined)
												{
													containerShell.newSubProject(pathNames[4], 5, pathNames[6], pathNames[7]);
												}
												else if (pathNames[6] != undefined)
												{
													containerShell.newSubProject(pathNames[4], 5, pathNames[6], 0);
												}
												else
												{
													containerShell.newSubProject(pathNames[4], 5, 0, 0);
												}
											}
										}
										else if (pathNames[5] != undefined)
										{
											if (comparePathNames(5) == true)
											{
												containerShell.updateProjectNav(pathNames[5]);
											}
											else
											{
												clonePathNames();
												containerShell.newProject(pathNames[4], pathNames[5]);
											}
										}
										else
										{
											containerShell.newProject(pathNames[4], 0);
										}
									}
									else if (pathNames[3] != undefined)
									{
										pathNamesClone = [];
										var _loc_3:int = 0;
										var _loc_6:int = 0;
										var _loc_7:* = ProjectsXml.projectsxml.projects.tier0;//myXML.nav.projects.tier0;
										var _loc_5:* = new XMLList("");
										for each (_loc_8 in _loc_7)
										{
											
											var _loc_9:* = _loc_7[_loc_6];
											with (_loc_7[_loc_6])
											{
												if (@label == "Exhibitions")
												{
													_loc_5[_loc_6] = _loc_8;
												}
											}
										}
										var _loc_4:* = _loc_5.tier1;
										var _loc_2:* = new XMLList("");
										for each (_loc_5 in _loc_4)
										{
											
											var _loc_6:* = _loc_4[_loc_3];
											with (_loc_4[_loc_3])
											{
												if (@label == "Name")
												{
													_loc_2[_loc_3] = _loc_5;
												}
											}
										}
										containerShell.newShell("nameShell", _loc_2.tier2, pathNames[3]);
									}
									break;
								}
								case "date":
								{
									if (pathNames[4] != undefined)
									{
										if (pathNames[5] == "sub")
										{
											if (comparePathNames(5) == true)
											{
												if (pathNames[7] != undefined)
												{
													containerShell.updateProjectSubNav(pathNames[6], pathNames[7]);
												}
												else if (pathNames[6] != undefined)
												{
													clonePathNames();
													containerShell.updateProjectSubNav(pathNames[6], 0);
												}
												else
												{
													clonePathNames();
													containerShell.updateProjectSubNav(0, 0);
												}
											}
											else
											{
												clonePathNames();
												if (pathNames[7] != undefined)
												{
													containerShell.newSubProject(pathNames[4], 5, pathNames[6], pathNames[7]);
												}
												else if (pathNames[6] != undefined)
												{
													containerShell.newSubProject(pathNames[4], 5, pathNames[6], 0);
												}
												else
												{
													containerShell.newSubProject(pathNames[4], 5, 0, 0);
												}
											}
										}
										else if (pathNames[5] != undefined)
										{
											if (comparePathNames(5) == true)
											{
												containerShell.updateProjectNav(pathNames[5]);
											}
											else
											{
												clonePathNames();
												containerShell.newProject(pathNames[4], pathNames[5]);
											}
										}
										else
										{
											containerShell.newProject(pathNames[4], 0);
										}
									}
									else
									{
										pathNamesClone = [];
										if (pathNames[3] != undefined)
										{
											var _loc_3:int = 0;
											var _loc_6:int = 0;
											var _loc_7:* = ProjectsXml.projectsxml.projects.tier0;//myXML.nav.projects.tier0;
											var _loc_5:* = new XMLList("");
											for each (_loc_8 in _loc_7)
											{
												
												var _loc_9:* = _loc_7[_loc_6];
												with (_loc_7[_loc_6])
												{
													if (@label == "Exhibitions")
													{
														_loc_5[_loc_6] = _loc_8;
													}
												}
											}
											var _loc_4:* = _loc_5.tier1;
											var _loc_2:* = new XMLList("");
											for each (_loc_5 in _loc_4)
											{
												
												var _loc_6:* = _loc_4[_loc_3];
												with (_loc_4[_loc_3])
												{
													if (@label == "Date")
													{
														_loc_2[_loc_3] = _loc_5;
													}
												}
											}
											containerShell.newShell("dateShell", _loc_2.tier2, pathNames[4]);
										}
									}
									break;
								}
								case "location":
								{
									if (pathNames[6] != undefined)
									{
										if (pathNames[7] == "sub")
										{
											if (comparePathNames(7) == true)
											{
												if (pathNames[9] != undefined)
												{
													containerShell.updateProjectSubNav(pathNames[8], pathNames[9]);
												}
												else if (pathNames[8] != undefined)
												{
													clonePathNames();
													containerShell.updateProjectSubNav(pathNames[8], 0);
												}
												else
												{
													clonePathNames();
													containerShell.updateProjectSubNav(0, 0);
												}
											}
											else
											{
												clonePathNames();
												if (pathNames[9] != undefined)
												{
													containerShell.newSubProject(pathNames[6], 7, pathNames[8], pathNames[9]);
												}
												else if (pathNames[8] != undefined)
												{
													containerShell.newSubProject(pathNames[6], 7, pathNames[8], 0);
												}
												else
												{
													containerShell.newSubProject(pathNames[6], 7, 0, 0);
												}
											}
										}
										else if (pathNames[7] != undefined)
										{
											if (comparePathNames(7) == true)
											{
												containerShell.updateProjectNav(pathNames[7]);
											}
											else
											{
												clonePathNames();
												containerShell.newProject(pathNames[6], pathNames[7]);
											}
										}
										else
										{
											containerShell.newProject(pathNames[6], 0);
										}
									}
									else if (pathNames[3] != undefined)
									{
										pathNamesClone = [];
										var _loc_3:int = 0;
										var _loc_6:int = 0;
										var _loc_9:int = 0;
										var _loc_12:int = 0;
										var _loc_13:* = ProjectsXml.projectsxml.projects.tier0;//myXML.nav.projects.tier0;
										var _loc_11:* = new XMLList("");
										for each (var xml:XML in _loc_13)
										{
											
											var _loc_15:* = _loc_13[_loc_12];
											with (_loc_13[_loc_12])
											{
												if (@label == "Exhibitions")
												{
													_loc_11[_loc_12] = xml;
												}
											}
										}
										var _loc_10:* = _loc_11.tier1;
										var _loc_8:* = new XMLList("");
										for each (_loc_11 in _loc_10)
										{
											
											var _loc_12:* = _loc_10[_loc_9];
											with (_loc_10[_loc_9])
											{
												if (@label == "Location")
												{
													_loc_8[_loc_9] = _loc_11;
												}
											}
										}
										var _loc_7:* = _loc_8.tier2;
										var _loc_5:* = new XMLList("");
										for each (_loc_8 in _loc_7)
										{
											
											var _loc_9:* = _loc_7[_loc_6];
											with (_loc_7[_loc_6])
											{
												if (@label == toUppercaseWithCaps(pathNames[3]))
												{
													_loc_5[_loc_6] = _loc_8;
												}
											}
										}
										var _loc_4:* = _loc_5.tier3;
										var _loc_2:* = new XMLList("");
										for each (_loc_5 in _loc_4)
										{
											
											var _loc_6:* = _loc_4[_loc_3];
											with (_loc_4[_loc_3])
											{
												if (@label == toUppercase(pathNames[4]))
												{
													_loc_2[_loc_3] = _loc_5;
												}
											}
										}
										containerShell.newShell("locationShell", _loc_2.tier4, pathNames[5]);
									}
									break;
								}
								case "visual":
								{
									if (pathNames[4] != undefined)
									{
										menuComponent.naveComp.hRule1On();
										if (pathNames[5] == "sub")
										{
											if (comparePathNames(5) == true)
											{
												if (pathNames[7] != undefined)
												{
													containerShell.updateProjectSubNav(pathNames[6], pathNames[7]);
												}
												else if (pathNames[6] != undefined)
												{
													clonePathNames();
													containerShell.updateProjectSubNav(pathNames[6], 0);
												}
												else
												{
													clonePathNames();
													containerShell.updateProjectSubNav(0, 0);
												}
											}
											else
											{
												clonePathNames();
												if (pathNames[8] != undefined)
												{
													containerShell.newSubProject(pathNames[4], 5, pathNames[6], pathNames[7]);
												}
												else if (pathNames[6] != undefined)
												{
													containerShell.newSubProject(pathNames[4], 5, pathNames[6], 0);
												}
												else
												{
													containerShell.newSubProject(pathNames[4], 5, 0, 0);
												}
											}
										}
										else if (pathNames[5] != undefined)
										{
											if (comparePathNames(5) == true)
											{
												containerShell.updateProjectNav(pathNames[5]);
											}
											else
											{
												clonePathNames();
												containerShell.newProject(pathNames[4], pathNames[5]);
											}
										}
										else
										{
											containerShell.newProject(pathNames[4], 0);
										}
									}
									else if (pathNames[3] != undefined)
									{
										pathNamesClone = [];
										var _loc_3:int = 0;
										var _loc_6:int = 0;
										var _loc_7:* = ProjectsXml.projectsxml.projects.tier0;//myXML.nav.projects.tier0;
										var _loc_5:* = new XMLList("");
										for each (_loc_8 in _loc_7)
										{
											
											var _loc_9:* = _loc_7[_loc_6];
											with (_loc_7[_loc_6])
											{
												if (@label == "Exhibitions")
												{
													_loc_5[_loc_6] = _loc_8;
												}
											}
										}
										var _loc_4:* = _loc_5.tier1;
										var _loc_2:* = new XMLList("");
										for each (_loc_5 in _loc_4)
										{
											
											var _loc_6:* = _loc_4[_loc_3];
											with (_loc_4[_loc_3])
											{
												if (@label == "Visual")
												{
													_loc_2[_loc_3] = _loc_5;
												}
											}
										}
										containerShell.newShell("visualShell", _loc_2, pathNames[3]);
									}
									break;
								}
								default:
								{
									break;
								}
							}
							break;
						}
						default:
						{
							break;
						}
					}
					break;
				}
			}
				
		}
	}
}